I have a listview which contains a column where I need to put two link buttons - Open and Download to open and download a server file respectively. I have an id column for each row of the list view. I have set the DataKeyNames property of listview to "ID" and verified that DataKeys get populated with the row values. On clicking a particular link button I need the selected ID to determine the link of the server file corresponding to that row. I have added the linkButton_click event but when I try to access SelectedDataKey inside the handler it remains null. How can I get the ID inside the click handler of the link button
how to get selected LinkButton in ListView
221620-Nov-2014
Sumit Kesarwani
20-Nov-2014you can use this:
and in designer:
<asp:LinkButton ID="ViewLinkButton" runat="server" CommandName="View" CommandArgument='<%# Eval("ID") %>' />